package com.itheima.homework;

import java.util.Scanner;

public class Demo7 {
    public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
        System.out.println("请输入一个小数进行四舍五入:");
    double i =sc.nextDouble();
        System.out.println("得到的整数为:"+zheng(i));
    }

    public static int zheng(double i){
        int a =(int)i;

        return (int) (i =i-a < 0.5 ? a : a+1);

    }

}
